import type { TableProps } from 'antd';
import type { GoodsData } from '../../types/goods';
import { Image, Tooltip } from 'antd';
export const GoodsColumnsList: () => Promise<TableProps<GoodsData>['columns']> = async () => {
    return [
        {
            title: 'id',
            dataIndex: 'id',
            key: 'id',
            align: 'center',
        },
        {
            title: '商品名称',
            dataIndex: 'goodsname',
            key: 'goodsname',
            align: 'center',
        },
        {
            title: '商品价格',
            dataIndex: 'goodsprice',
            key: 'goodsprice',
            align: 'center',
        },
        {
            title: '商品数量',
            dataIndex: 'goodsnum',
            key: 'goodsnum',
            align: 'center',
        },
        {
            title: '商品描述',
            dataIndex: 'goodsdesc',
            key: 'goodsdesc',
            align: 'center',
            onCell: () => {
                return {
                    style: {
                        maxWidth: 200,
                        overflow: 'hidden',
                        whiteSpace: 'nowrap',
                        textOverflow: 'ellipsis',
                        cursor: 'pointer',
                    },
                };
            },
            render: (sql) => (
                <Tooltip placement="topLeft" title={sql}>
                    {sql}
                </Tooltip>
            ),
        },
        {
            title: '图片',
            dataIndex: 'goodsimg',
            key: 'goodsimg',
            align: 'center',
            render: (goodsimg: string) => (
                <Image
                    width={80}
                    height={80}
                    src={goodsimg}
                />
            ),
        },
    ]
}